package com.example.a_buffer;

import java.io.BufferedWriter;
import java.io.FileWriter;

public class Demo2BufferedWriter {
    public static void main(String[] args) {

        try (FileWriter fileWriter = new FileWriter("ab.txt", true);
             BufferedWriter bw = new BufferedWriter(fileWriter);) {
            bw.write("窗前明月光");
            bw.newLine();
            bw.write("疑是地上霜");
            bw.newLine();
            bw.write("举头望明月");
            bw.newLine();
            bw.write("低头思故乡");
            bw.newLine();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
